package com.kuang.order.controller;

import com.kuang.bascic.utils.AjaxResult;
import com.kuang.order.service.OrderAdoptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.lang.ref.PhantomReference;
import java.util.Map;

@RestController
@RequestMapping("/adop")
public class AdoptController {
    @Autowired
    private OrderAdoptService orderAdoptService;
    @PostMapping("/createOrder")
    public AjaxResult createOrder(@RequestBody Map<String,String> map, HttpServletRequest req){
        try {
            String order = orderAdoptService.createOrder(map, req);
            return AjaxResult.me().setResultObj(order);
        } catch (Exception e) {
            return AjaxResult.me().setMessage("网络错误");
        }

    }
}
